<?php

require_once dirname(__FILE__) . '/../lib/comerciosGeneratorConfiguration.class.php';
require_once dirname(__FILE__) . '/../lib/comerciosGeneratorHelper.class.php';

/**
 * comercios actions.
 *
 * @package    tercermilenio
 * @subpackage comercios
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class comerciosActions extends autoComerciosActions {

    public function executeIndex(sfWebRequest $request) {

        $existe = ComerciosPeer::existe();

        if (!$existe) {
            $this->redirect('@comercios_new');
        } else {
            $comercios = ComerciosPeer::doSelectOne(new Criteria());


            $this->redirect(array('sf_route' => 'comercios_edit', 'sf_subject' => $comercios));
            //$this->redirect('comercios/edit?' . $comId);
        }
    }

    public function executeEdit(sfWebRequest $request) {
        $this->comercios = $this->getRoute()->getObject();
        $this->form = $this->configuration->getForm($this->comercios);
    }

}
